package com.zyh.work2

import scala.io.StdIn
import scala.util.control.Breaks

object Tourists{
  def main(args: Array[String]): Unit = {
    Breaks.breakable{
      while(true) {
        print("请输入姓名：")
        val name: String = StdIn.readLine()
        if (name equals "n") {
          println("退出程序"); Breaks.break()
        }
        print("请输入年龄：")
        val age: Int = StdIn.readInt()
        var fare: String = "免费"
        if (age > 18) fare = "20元"
        println(s"${name}的年龄为${age},门票价格为:${fare}")
      }
    }
  }
}
case class Tourists(name:String,age:Int)
